#include "stdafx.h"
#include "SpriteUFO.h"
#include "StructureAndConst.h"
#include "SpriteSingleFrame.h"
#include "SpriteMultiFrame.h"
#include "SpriteStretch.h"
#include "DisplayController.h"

SpriteUFO::SpriteUFO(int nLayer,D3DXVECTOR2 posFlyOut):SpriteCombined(nLayer)
{
	LPDIRECT3DTEXTURE9 pTexture=NULL;
	SpriteSingleFrame* p=NULL;
	CREATE_SPRITE_SINGLE_FRAME(p,ptCOLLECT_UFO,picCOLLECT_UFO,nLayer,false,false,JUDGE_POINTER_RE_VOID)
	p->SetCenter(D3DXVECTOR2(picCOLLECT_UFO.nWidth/2.0f,0.0f));
	AddSprite(p);

	SpriteStretch *p2;
	CREATE_TEXTURE(ptCOLLECT_UFO_FIREB,picCOLLECT_UFO_FIREB,JUDGE_POINTER_RE_VOID);
	p2=new SpriteStretch(pTexture,picCOLLECT_UFO_FIREB.nWidth,picCOLLECT_UFO_FIREB.nHeight,nLayer);
	JUDGE_POINTER_RE_VOID(p2);
	p2->m_vPosition=D3DXVECTOR2((picCOLLECT_UFO.nWidth+picCOLLECT_UFO_FIREA.nWidth)/2.0,picCOLLECT_UFO.nHeight/2.0f);
	p2->SetCenter(D3DXVECTOR2(0,picCOLLECT_UFO_FIREB.nHeight/2.0f));
	posFlyOut.y+=picCOLLECT_UFO_FIREB.nHeight;
	p2->SetStretchEnd(posFlyOut);
	AddSprite(p2);

	SpriteMultiFrame* p1;
	CREATE_SPRITE_MULTI_FRAME(p1,ptCOLLECT_UFO_FIREA,picCOLLECT_UFO_FIREA,nLayer,-1,false,false,JUDGE_POINTER_RE_VOID)
	p1->m_vPosition=D3DXVECTOR2(picCOLLECT_UFO.nWidth/2.0f,picCOLLECT_UFO.nHeight/2.0f);
	p1->SetCenter(D3DXVECTOR2(0,picCOLLECT_UFO_FIREA.nHeight/2.0f));
	AddSprite(p1);
}

SpriteUFO::~SpriteUFO(void)
{
	//base class will delete the points
}

bool SpriteUFO::Draw(DWORD dwCurrentTime)
{

	return SpriteCombined::Draw(dwCurrentTime);
}